package com.amigo.online.provider.sync.cloud.zuul;

import javax.servlet.http.HttpServletRequest;

import com.amigo.online.common.core.response.StatusCode;
import com.amigo.online.common.util.StringUtils;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

public class AccessFilter extends ZuulFilter {

    @Override
    public boolean shouldFilter() {
        return false;
    }

    @Override
    public Object run() throws ZuulException {
        RequestContext ctx = RequestContext.getCurrentContext();
        HttpServletRequest request = ctx.getRequest();
        String token = request.getHeader("ACCESS_TOKEN");
//        if(StringUtils.isEmpty(token)) {
//        	throw new TokenException(StatusCode.UNAUTHORIZED);
//        }
//        // 检查 token 有效性
//        if (!tokenManagerService.checkToken(token)) {
//            throw new TokenException(StatusCode.UNAUTHORIZED);
//        }
        return true;
    }

    @Override
    public String filterType() {
        return null;
    }

    @Override
    public int filterOrder() {
        return 0;
    }

}
